<?php // no direct access
defined('_JEXEC') or die('Restricted access'); 
global $mainframe;
?>
<?php
/*
<div id="ext_mod_bookstore" style="width: 930px; height: 130px; float:left; margin: 0px 0px 0px 0px; background-image: url(http://192.150.1.246/stable/templates/bookstore2/images/ext.gif); background-repeat:no-repeat; display:<?php echo $stat['display']; ?>; ">
	<form action="<?php echo $component_url; ?>" method="post" name="queryForm" target="_top" id="bookstore_queryForm" class="form-bookstore_query">
		<div  >			
			<div>
            
            <?php //<input type="text" name="terms" id="query_box" size="33" class="inputbox" value="<?php
			//echo 'Extended Query Coming Soon!';
			
			
			 ?>
             <?php
			 //             " />
             ?>
             </div>
             <div class="col width-30" style="float:right; clear:none; height: 400px;">
	<fieldset class="adminform">
		<legend><?php echo JText::_( 'Staff Selection Parameters' ); ?></legend>

		<table class="admintable">
		<tr>
			<td valign="top" width="320" style="padding: 7px 0 0 5px">
             <?php
			 //	modBookstoreHelper::getExtForm();
			 jimport('joomla.html.pane');
			// jimport('joomla.presentation.pane');
			 JHTML::stylesheet('modal.css');
			 //JHTML::stylesheet('modal.css','/stable/administrator/templates/khepri/css/');

		$pane	=& JPane::getInstance('sliders');
		$layout = JModuleHelper::getLayoutPath('mod_bookstore');
		$xml = substr($layout, 0, -11).'extended.xml';
		$form = new JParameter( '', $xml);	
		$fields = "isbn1=0123456789\npublisher=random house\n";
		$form->loadINI($fields);
		//var_dump($xml);
		//var_dump($form);
		echo $pane->startPane("content-pane");
		
		$title = JText::_( 'Simple Query' );
		echo $pane->startPanel( $title, "detail-page" );
		echo $form->render('params','simple');
		echo $pane->endPanel();
		
		$title = JText::_( 'Advanced Query' );
		echo $pane->startPanel( $title, "params-page" );
		echo $form->render('params', 'advanced');
		echo $pane->endPanel();
		
		echo $pane->endPane();
	
			 ?>   
             </td>
		</tr>
		</table>
	</fieldset>
</div>          
			 <div style="width:20px; float:left; margin: 2px 0px 0px 0px;">
			<?php
			//<div style="float:left; width:100px"><input type="checkbox" name="instock_only" id="instock_only" class="inputbox" value="checked" 
			$url	= 'components'.DS.'com_bookstore'.DS.'helpers'.DS.'instructions.php';
				$status = "{handler: 'iframe', size: {x: 650, y: 650}}";
				$link_attribs['class']	= JText::_( 'modal' );
				$link_attribs['rel'] = "".$status."";
				$text = '<img src="/stable/images/iicon.png" alt="Getting Started with BookPeople Book Search" style="border: medium none ; text-decoration: none; width: 20px; height: 20px;">';
				$link = JHTML::_('link',$url, $text, $link_attribs);
				//$html .= $link;
				echo $link;
			 ///>In stock only</div>
			  ?></div>
        </div>
	<input type="hidden" name="instock_only" value="checked" />
	<input type="hidden" name="option" value="com_bookstore" />
    <input type="hidden" name="view" value="bookstore" />
    <input type="hidden" name="query_type" value="1" />
    
	</form>
    
</div>

*/
//$terms = JRequest::getVar('terms','');
$terms = $mainframe->getUserState( "com_bookstore.query.orig_terms", '' );
//var_dump($terms);

JFilterOutput::objectHTMLSafe($terms);
if(empty($terms['simple'])){
	$terms['simple'] = '  -- Quick Search --';
}
?>
<?php 
//var_dump($this->items->debug);
//	$terms = JRequest::getVar('terms');
	if($terms['offset'] == '1'){
		//erase terms[simple]
		$terms['simple'] = '  -- Quick Search --';
	}else{
		foreach($terms as $key=>$value){
			if( ($key != 'offset') && ($key != 'simple') ){
				$terms[$key] = '';
			}//end if 'offset or simple'
		}//end foreach
	}//edn if ofset is 1
	
	JRequest::setVar('terms',$terms);


?>

<div style="float:left; clear:none;width:280px; margin-right: -17px; margin-bottom:-12px; ">
		<table >
		<tr>
			<td valign="top" width="280" style="padding: 7px 0px 0px 0px">
            <form action="<?php echo $component_url; ?>" method="post" name="queryForm" target="_top" id="bookstore_queryForm" class="form-bookstore_query">
	<fieldset style="border:none; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px" >

             <?php
			 //	modBookstoreHelper::getExtForm();
			 jimport('joomla.html.pane');
			// jimport('joomla.presentation.pane');
			 JHTML::stylesheet('modal.css');
			 //JHTML::stylesheet('modal.css','/stable/administrator/templates/khepri/css/');
		require_once(JPATH_ROOT.'/modules/mod_bookstore/elements/extform.php');
		//$query_type = JRequest::getVar('query_type', 'Search');
		//$offset = $mainframe->getUserState( "com_bookstore.query.terms.offset", 0 ); 
		//var_dump($offset);
		//($query_type == 'Search')? $offset = 0: $offset = 1;
		$pane	=& JPane::getInstance('sliders',array('startOffset'=>$terms['offset'] ) );
		$layout = JModuleHelper::getLayoutPath('mod_bookstore');
		//$xml = substr($layout, 0, -11).'extended.xml';
		$xml = JPATH_ROOT.DS.'modules/mod_bookstore/tmpl/'.'extended.xml';
		$form = new JParameter( '', $xml);	
		$fields = array(
					"terms"=>"Quick Search",
					"isbn"=>"0123456789",
					'publisher'=>'random house',
					'author'=>'',
					'title'=>'');
		$form->loadArray($terms);
		//var_dump($xml);
		//var_dump($form);
		echo $pane->startPane("content-pane");
		
		$title = JText::_( 'Quick Search' );
		echo $pane->startPanel( $title, "detail-page" );
		//echo $form->render();
		echo '<div style="float:left;width:187px; margin: 1px 0px 2px 12px;"><input type="text" size="26" class="text_area" value="'
				.htmlentities($terms['simple'])
				.'" id="paramsterms" name="terms[simple]" /></div>'
				.'<div style="float:left;width:60px; margin: 1px 0px 2px 3px"><input type="submit" name="query_type" class="submit" value="Search"/></div>';
		
		echo $pane->endPanel();
		?>
        
		<input type="hidden" name="option" value="com_bookstore" />
    	<input type="hidden" name="view" value="bookstore" />
	    <input type="hidden" name="terms[instock]" value="0" />    
    
	</form>
    <form action="<?php echo $component_url; ?>" method="post" name="queryForm2" target="_top" id="bookstore_queryForm2" class="form-bookstore_query">
	

    <?php
		//<fieldset style="border:none; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px" >
		$title = JText::_( 'Advanced Query' );
		echo $pane->startPanel( $title, "params-page" );
		echo $form->render('params', 'advanced');
		echo $pane->endPanel();
		
		echo $pane->endPane();
	/*	 */
			   echo '<div style="width:20px; float:right; margin: -4px 0px -14px 0px; position:relative;top:-10px;right:10px">';
			
			
			$url	= 'components'.DS.'com_bookstore'.DS.'helpers'.DS.'instructions.php';
				$status = "{handler: 'iframe', size: {x: 650, y: 650}}";
				$link_attribs['class']	= JText::_( 'modal' );
				$link_attribs['rel'] = "".$status."";
				$text = '<img src="/stable/images/iicon.png" alt="Getting Started with BookPeople Book Search" style="border: medium none ; text-decoration: none; width: 20px; height: 20px;">';
				$link = JHTML::_('link',$url, $text, $link_attribs);
				//$html .= $link;
				echo $link;
			 ///>In stock only</div>
			  echo '</div>';
			  echo '<div style="width:20px; float:right; margin: -4px 0px 0px 0px;position: relative; top: -10px;left: -17px">'
			  .'<a href="/stable/index.php?Itemid=5" style="border:none; text-decoration:none">'
			  .'<img src="/stable/images/house.jpg" alt="BookPeople Book Search Home" style="border: medium none ; text-decoration: none; width: 20px; height: 20px;" />'
			  .'</a>'
			  .'</div>';
             ?>
             </fieldset>
	<input type="hidden" name="option" value="com_bookstore" />
    <input type="hidden" name="view" value="bookstore" />    
	</form>
         </td>
		</tr>
		</table>
	
    
</div>    